﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hangman.Controls
{
    public partial class Keyboard : System.Web.UI.UserControl
    {
        Dictionary<string, int> keyboardLayout = new Dictionary<string, int>();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void Init()
        {
            for (char c = 'A'; c < 'Z'; c++)
            {
                keyboardLayout.Add(c.ToString(), 1);
            }
        }

        public void Draw()
        {
            for (char c = 'A'; c < 'Z'; c++)
            {
                int value = keyboardLayout[c.ToString()];
                string currentKey = c.ToString();
                if (value == 0)
                {
                    currentKey = "<span style='color:yellow'>"+c.ToString()+"</span>";
                }
                this.Controls.Add(new LiteralControl(currentKey+ "_" + value + "    "));
            }
        }

        public void DisableKey(string key)
        {
            keyboardLayout[key] = 0;
        }

        public void Reset()
        {
        }
    }
}